#include <stdio.h>

int fac(int n);

int main(void)
{
    int n, i;
    scanf("%d", &n);

    long sum = 0;
    for (i = 1; i <= n; i++)
        sum += fac(i);

    printf("%d的阶乘和为：%ld\n", n, sum);
    return 0;
}

int fac(int n) {
    if (n == 1)
        return 1;

    return n * fac(n - 1);
}
